package models

import (
	"github.com/goravel/framework/contracts/database/factory"
	"github.com/goravel/framework/database/orm"
	"github.com/goravel/framework/support/carbon"
	"goravel/database/factories"
)

type Device struct {
	orm.Model
	UserID        uint            `gorm:"column:user_id;comment:'运营商ID'" form:"user_id" json:"user_id"`
	Code          string          `gorm:"column:code;comment:'设备编码'" form:"code" json:"code"`
	Name          string          `gorm:"column:name;comment:'设备名称'" form:"name" json:"name"`
	BoardModel    string          `gorm:"column:board_model;comment:'主板型号'" form:"board_model" json:"board_model"`
	OnlineAt      carbon.DateTime `gorm:"column:online_at;comment:'上线时间'" form:"online_at" json:"online_at"`
	LocationAt    carbon.DateTime `gorm:"column:location_at;comment:'定位时间'" form:"location_at" json:"location_at"`
	Address       string          `gorm:"column:address;comment:'地址'" form:"address" json:"address"`
	BatteryStatus string          `gorm:"column:battery_status;comment:'电池状态'" form:"battery_status" json:"battery_status"`
	Spec          string          `gorm:"column:spec;comment:'规格'" form:"spec" json:"spec"`
	TowerCode     string          `gorm:"column:tower_code;comment:'基站编码'" form:"tower_code" json:"tower_code"`
	SerialNumber  string          `gorm:"column:serial_number;comment:'串数'" form:"serial_number" json:"serial_number"`
	Devicestates  []Devicestate
}

func (*Device) Factory() factory.Factory {
	return &factories.DeviceFactory{}
}
